<template>
 <button @click="showInfor">点击按钮更换图片</button>
 <img :src="url" />
 <input type="text" @keypress="showInfor1">
</template>

<script setup>
// 方法一
// function showInfor(){

// }
//方法二
import { ref } from "vue"
//显示图片
let url= ref(new URL("../assets/img1.png",import.meta.url).href);
    const showInfor = () => {
//   console.log("欢迎来到Vue3内置指令");
url.value= new URL("../assets/img2.png",import.meta.url).href;
};
const showInfor1 = () => {
     alert("按下按钮");
};
</script>


<style>

</style>